package common.data.monitor {
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;

	public class MonitorService extends RemoteObject {
		
		public var getPhoneStateCallBack:Function;
		
		public function MonitorService() {
			super("monitorService");
			this.showBusyCursor = false;
			this.getOperation("getPhoneState").addEventListener(ResultEvent.RESULT,getPhoneStateResult,false,0,true);
			
			this.getOperation("getAlarmStatCount").addEventListener(ResultEvent.RESULT,getAlarmStatCountResult,false,0,true);
			
		}
		
		public function getPhoneState():void{
			this.getOperation("getPhoneState").send();
		}
		
		private function getPhoneStateResult(e:ResultEvent):void{
			getPhoneStateCallBack.apply(this,[e]);
		}
		
		public var getAlarmStatCountCallBack:Function;
		
		//更新报文查岗等信息模型
		public function getAlarmStatCount(alarmCode:String,callBack:Function=null):void{
			if(callBack){
				this.getAlarmStatCountCallBack = callBack;
			}
			this.getOperation("getAlarmStatCount").send(alarmCode);
		}
		
		//更新报文报警结果
		public function getAlarmStatCountResult(e:ResultEvent):void{
			if(getAlarmStatCountCallBack!=null){
				var objArr:Object = e.result;//DataUtil.decompress(e.result as ByteArray);
				getAlarmStatCountCallBack.apply(this,[objArr]);
			}
		}
	}
}	